package icu.sehnen.controller;


import icu.sehnen.common.CommonResult;
import icu.sehnen.model.WallpaperModel;
import icu.sehnen.service.WallpaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/wallpaper")
public class WallpaperController {

    @Autowired
    WallpaperService wallpaperService;

    @GetMapping("/list")
    public  CommonResult findAll(){
     List<WallpaperModel> wallpaperModelList= wallpaperService.findAll();
    return CommonResult.success(wallpaperModelList);

    }
    @PutMapping("/update")
    public  CommonResult update(Long id,String imgUrl){
        wallpaperService.update(id,imgUrl);
        return CommonResult.success();
    }


}
